<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>留同学-预约辅导直播间</title>
    <script src="https://download.agora.io/edu-apaas/release/edu_sdk_1.1.5.js"></script>
</head>
<body>
<style>
    #root1 {
        width: 100%;
        height: 100%;
    }
</style>
<div id="root1"></div>
<script type="text/javascript">
    AgoraEduSDK.config({
        appId: '[[${appId}]]',
    })
    AgoraEduSDK.launch(
        document.querySelector("#root1"), {
            // 此处替换成你的 RTM Token
            rtmToken: '[[${rtmToken}]]',
            // 请确保此次的用户 ID 和你在生成临时 RTM Token 时使用的用户 ID 保持一致
            userUuid: '[[${userId}]]',
            userName: '[[${userName}]]',
            roomUuid: '[[${roomId}]]',
            roomName: '[[${roomName}]]',
            roleType: [[${roleType}]],
            roomType: [[${roomType}]],
            pretest: [[${pretest}]],
            language: '[[${language}]]',
            region:'[[${region}]]',
            startTime: new Date().getTime(),
            duration: [[${duration}]],
            courseWareList: [],
            listener: (evt) => {
                console.log('evt', evt)
                if (evt == 2) {
                    // 向父vue页面发送信息
                    window.parent.postMessage({
                        cmd: 'close',
                        params: {
                            success: true
                        }
                    }, '*');
                    window.close();
                }
            }
        }
    )
    // 接受父页面发来的信息
    window.addEventListener("message", function (event) {
        var data = event.data;
        switch (data.cmd) {
            case 'start':
                break;
        }
    });
</script>
</body>
</html>